package net.wanho.service.impl;

import net.wanho.dto.LoginUser;
import net.wanho.service.AuthService;
import net.wanho.util.JwtUtil;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
 * Author：汤小洋
 * Date：2023-11-13 16:52
 * Description：<描述>
 */
@Service
public class AuthServiceImpl implements AuthService {

    @Override
    public String login(LoginUser loginUser) {
        /**
         * 1.校验验证码
         */

        /**
         * 2.校验用户名和密码
         */
        // SysUser sysuser = userMapper.selectByUsername(loginUser.getUsername());


        /**
         * 3.生成token
         */
        Map<String,Object> payload = new HashMap<>();
        payload.put("username",loginUser.getUsername());
        String token = JwtUtil.generate(payload);

        return "Bearer " + token;
    }

}
